require(['./config'],()=>{
    require(['header','jqc'],()=>{
        class Register {
            constructor () {
                this.register()
            }
            register () {
                $('#btn-r').on('click',() => {
                    const name=$('#register_user').val()
                    console.log(name)
                    const pwd=$('#register_pwd').val()
                    console.log(pwd)
                    $.post('http://localhost:8080/er-lou/api/user/register.php',{name,pwd},resp=>{
                        console.log(resp)
                        if(resp.code==200){
                            alert('恭喜你注册成功了,即将跳转登录页')
                            location.replace('/html/login.html')
                        }else{
                            alert('注册失败')
                        }
                    },'json')
                })
            }
        }
        new Register()
    })
})